<template>
    <template v-if="item.childList&&item.childList.length>0">
        <el-sub-menu :index="`${item.id}+''`">
            <template #title>
                <!-- 动态渲染图标 -->
                <el-icon>
                    <component :is="item.icon"></component>
                </el-icon>
                <span>{{ item.name }}</span>
            </template>
            <AsideMenuItem v-for="(subItem,sIndex) in item.childList" :key="sIndex" :item="subItem"></AsideMenuItem>
        </el-sub-menu>
    </template>
    <template v-else>
        <el-menu-item :index="item.component">
            <template #title>
                <span>{{ item.name }}</span>
            </template>
        </el-menu-item>
    </template>
</template>

<script lang='ts' setup>
import {MenuType} from '@/types/menu'
defineProps<{item:MenuType}>()
</script>

<style lang='scss' scoped>
</style>